package com.jinzihan.junit;

import com.jinzihan.dao.OrderDao;
import com.jinzihan.dao.impl.OrderDaoImpl;
import com.jinzihan.entity.Order;
import org.junit.jupiter.api.Test;

import java.sql.Date;
import java.util.List;

class OrderDaoTest {
    OrderDao orderDao = new OrderDaoImpl();
    @Test
    void saveOrder() {
        orderDao.saveOrder(new Order(null,1,2,new Date(1),1));
        orderDao.saveOrder(new Order(null,2,1,new Date(1),5));
        orderDao.saveOrder(new Order(null,3,0,new Date(1),4));
    }

    @Test
    void queryMyOrders() {
        List<Order> orders = orderDao.queryMyOrders(2);
        orders.forEach(System.out::println);
    }

    @Test
    void queryAllOrders() {
        List<Order> orders = orderDao.queryAllOrders();
        orders.forEach(System.out::println);
    }

    @Test
    void changeOrderStatus() {
        orderDao.changeOrderStatus(1,1);
    }
}